using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;

namespace ProjectEuler.Core
{
    public class Problem1 :IProjectEulerProblem
    {
        // If we list all the natural numbers below 10 that are multiples of 3 or 5,
        // we get 3, 5, 6 and 9. The sum of these multiples is 23.
        protected static IList<int> AllNaturalNumbersBelow(int x)
        {
            var list = new List<int>();
            for (int i = 3; i < x; i++)
            {
                if (((i%3) == 0) || ((i%5 == 0)))
                {
                    list.Add(i);
                }
            }
            return list;
        }

        public int Number
        {
            get { return 1; }
        }

        public string Description
        {
            get { return "Find the sum of all the multiples of 3 or 5 below 1000"; }
        }

        public string Answer
        {
            get { return AllNaturalNumbersBelow(1000).Sum().ToString(); }
        }
    }

    [TestFixture]
    public class Problem1Tests : Problem1
    {
        [Test]
        public void Test_natural_numbers_below_10()
        {
            var list = AllNaturalNumbersBelow(10);
            Assert.IsTrue(list.Contains(3));
            Assert.IsTrue(list.Contains(5));
            Assert.IsTrue(list.Contains(6));
            Assert.IsTrue(list.Contains(9));
            Assert.AreEqual(4, list.Count);
        }
    }
}